﻿@model Forum
@{
	ViewBag.Title = Model.Name;
    ViewData["currentForum"] = this.Model;
	if (IsAction("MostViewedTopics"))
	{
		ViewBag.Title = T("{0} - Most viewed", Model.Name);
	}
	else if (IsAction("LatestTopics"))
	{
		ViewBag.Title = T("{0} - Latest activity", Model.Name);
	}
}
@section Head
{
	@if (IsAction("Detail"))
	{
		@Html.MetaDescription(Model.Description)
	}
}
<div class="forumDetail">
	<ul class="path floatContainer">
		<li class="first">@Html.ActionLinkLocalized("Forums", "List", "Forums")</li>
	</ul>
    <div class="list_programa">
        @if (Model.ForumIcon == null)
        {
            <img class="iconImg" src=@Url.Content("~/images/Forums/empty.jpg") alt=@Model.Id />
        }
        else
        {
            <img class="iconImg" src=@Url.Content(Model.ForumIcon) alt=@Model.Id />
        }
        <h1>@ViewBag.Title</h1>
        @if (IsAction("Detail"))
	    {
		    <p class="description">@Model.Description</p>
	    }
    </div>

	<div id="pages_btn">
    @if (Model.HasPostAccess(Role))
	{
		<div class="postbtn">@Html.ActionLinkLocalized("Post a thread >>", "Add", "Topics", new{forum=this.Model.ShortName}, null)</div>
	}
    
	@Html.Partial("ForumOptions")
	</div>
    <p />
    <div class="list_tool">
       <p>@T("Click the tag then show the type of topics")</p>
       @Html.ActionLink("全部", "Detail", new { page = 0 }, IsAction("Detail") ? new { @class = "tool_item" } : null)
       @foreach (TopicType t in Model.topicTypeList)
       {
           @Html.ActionLink(t.TypeName, "Detail", "Forums", new { forumId = Model.Id, page = 0, typeID = t.TypeID },
                new { @class = "tool_item" });
       }
    </div>

	@if (this.Model.Topics.Count > 0)
 {
     Html.RenderPartial("ForumTopicList", this.Model.Topics);
 }
 else
 {
		<p class="warning">@T("No threads for this forum.")</p>
 }
	@Html.Pager(Config.UI.TopicsPerPage, this.PageIndex, (int)ViewData["TotalTopics"], S("Previous"), S("Next"))
	@Html.Partial("TagCloud", ViewData.Get<List<WeightTag>>("Tags"))

	
	@if (Role >= UserRole.Moderator)
 {
	<div class="toolbar floatContainer">
		<ul>
			<li class="edit">@Html.ActionLinkLocalized("Edit", "Edit", new { forumId = Model.Id})</li>
			<li class="manage">@Html.ActionLinkLocalized("Manage forums", "Manage")</li>
		</ul>
	</div>
	}
</div>
